<template>
  <div class="login">
    <div class="login_header">
      <div class="login_top">
        <img src="http://39.97.105.66/pic/icon/SHOES.png" alt="">
      </div>
      <div class="login_bottom">
        <span>SHOES服务平台</span>
        <span>员工端</span>
      </div>
    </div>
    <div class="form">
      <van-form @submit="onSubmit">
        <van-field
          v-model="username"
          name="用户名"
          label="用户名"
          placeholder="用户名"
          :rules="[{ required: true, message: '请填写用户名' }]"
        />
        <van-field
          v-model="password"
          type="password"
          name="密码"
          label="密码"
          placeholder="密码"
          :rules="[{ required: true, message: '请填写密码' }]"
        />
        <div style="margin:25px 30px 10px 30px">
          <van-button round block type="info" native-type="submit" color="#E4687D">登录</van-button>
        </div>
      </van-form>
    </div>
    <div class="login_text">
      <span>用户名: marry</span>
      <span>密码: 123321</span>
    </div>
    <div class="login_laber">
      <span>Welcome to the SHOES Waiter Platform！</span>
    </div>
  </div>
</template>

<script>
import {mapState,mapActions} from "vuex"
export default {
  data() {
    return {
      username: "",
      password: ""
    };
  },
  computed:{
      ...mapState('login',['userInfo'])
  },
  methods: {
      ...mapActions('login',['login','info']),
    onSubmit(values) {
      let obj = {
          username:this.username,
          password:this.password,
          type:'waiter'
      }
      this.login(obj).then(res=>{
          this.$router.push({path:'/manager/index',query:{user:this.userInfo}})
      })
    }
  }
};
</script>
<style>
.form{
  margin-top:10px;
}
.login_header {
  width: 100%;
  height: 250px;
  background-color: #E4687D;
  overflow: hidden;
}
.login_top {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border:1px solid #fff;
  margin: 0 auto;
  margin-top: 50px;
  line-height: 60px;
  text-align: center;
  font-size: 20px;
  font-weight: bold;
  color: #fff;
  position: relative;
}
.login_top>img{
  position: absolute;
  top:12px;
  left:12px;
  width:35px;
  height:35px;
}
.login_bottom {
  margin-top: 10px;
  text-align: center;
}
.login_bottom span:first-child {
  font-size: 25px;
  color: #fff;
  margin-right: 10px;
}
.login_bottom span:last-child {
  font-size: 20px;
  color: #fff;
}
.login_text>span{
  margin-left:20px;
  font-size:13px;
}
.login_laber{
  width:100%;
  text-align: center;
  position: absolute;
  bottom:15px;
  margin:0 auto;
  font-size:13px;
  color:#E4687D
}
</style>